package day012.homework.p5;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("生日（yyyy-MM-dd）:");
        String birthday = sc.nextLine();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date date=sdf.parse(birthday);
            long startTime= date.getTime();

            Date date1 = new Date();
            long endTime = date1.getTime();

            System.out.println("来到世界" + (endTime - startTime) / (1000L * 60 * 60 * 24) + "天");
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}
